package com.ming.attendance.controller;


import com.ming.attendance.po.ResponseBean;
import com.ming.attendance.service.WxGroupService;
import com.ming.attendance.utils.JWTUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/WxGroup")
public class WxGroupController {

    @Autowired
    private WxGroupService gs;

    @PostMapping("/addOpengid")
    public ResponseBean<Integer> addOpengid(@RequestHeader("Authorization") String token, String opengid){
        String openid = JWTUtils.getOpenid(token);
        System.out.println("openid: >>>>>> "+openid);
        System.out.println("opengid: >>>>>> "+opengid);
        return gs.addOpengid(openid,opengid);
    }
}
